package handin06;

import static org.junit.Assert.*;

import org.junit.Test;

public class VendingMachineUnitTester {
	
	@Test
	public void testInsertCoin() {
		VendingMachine machine = new VendingMachine();
		machine.insertCoin(new Dollar());
		machine.insertCoin(new Quarter());
		machine.insertCoin(new Dime());
		machine.insertCoin(new Nickel());
		machine.insertCoin(new Penny());
	}

	@Test
	public void testDispenceProduct() {
		VendingMachine machine = new VendingMachine();
		machine.insertCoin(new Dollar());
		machine.insertCoin(new Dollar());
		Valuable[] testArray = {new Cola(), new Penny()};
		assertArrayEquals("Result", testArray, machine.dispenceProduct(ProductType.COLA).toArray());
	}

	@Test
	public void testGiveChange() {
		VendingMachine machine = new VendingMachine();
		machine.insertCoin(new Dollar());
		Valuable[] testArray = {new Dollar()};
		assertArrayEquals("Result", testArray, machine.giveChange().toArray());
	}
}
